﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Xml.Linq;
using System.Collections.Generic;

namespace JetLag2011
{
    public interface ITopTenEntry
    {
        string Name { get; }
        int Score { get; }
        bool Marked { get; }
    }
    public class TopTenEntry:ITopTenEntry
    {
        public string Name { get; set; }
        public int Score { get; set; }
        public bool Marked{get;set;}
        public TopTenEntry()
            : this(Constants.TopTen.Defaults.Name, Constants.TopTen.Defaults.Score, Constants.TopTen.Defaults.Marked)
        {
        }
        public TopTenEntry(string theName, int theScore, bool theMarked)
        {
            Name = theName;
            Score = theScore;
            Marked = theMarked;
        }
        public TopTenEntry(XElement fromElement)
        {
            FromXElement(fromElement);
        }
        private void FromXElement(XElement fromElement)
        {
        }
        public XElement ToXElement(XName name)
        {
            XElement result = new XElement(name);
            result.Add(new XElement(Names.XElements.Name, Name),
                new XElement(Names.XElements.Score, Score));
            if (Marked)
            {
                result.Add(new XElement(Names.XElements.Marked));
            }
            return result;
        }
    }
}
